#ifndef DATAMANAGER_H
#define DATAMANAGER_H

#include "data.h"
#include "memexception.h"
#include <cppconn/prepared_statement.h>
#include "mysqlconnection.h"
#include <string>
static sql::Connection *con=NULL;

class Owns
{
    public:
        Owns();
        int addCard(string memberName,string cardType, int times=-1);
        void insert(string memName,string type,string startTime,
                    string endTime,int times=-1,int statement=1)throw(DBException);
        //int select(string name) throw(DBException);
        virtual ~Owns();
    protected:
    private:
        mysqlconnection connection;
        sql::PreparedStatement *pstmt;
};

class Member
{
    public:
    Member();
    ~Member();
    int addMember(string memName, string memAddr, string memOccu);// int* pMid);
    void insert(string memName, string memAddr, string memOccu) throw(DBException);
    int select(string name) throw(DBException);
    private:
        mysqlconnection connection;
        sql::PreparedStatement *pstmt;
        //sql::Statement *state;
};

class Card
{
    Card();
    virtual ~Card();
};

#endif // DATAMANAGER_H
